package com.yyfax.pay.third.model.to.fuiou;

import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.io.xml.QNameMap;
import com.thoughtworks.xstream.io.xml.StaxDriver;
import com.yyfax.framework.model.Content;

/**
 * 订单结果查询接口（富友订单号）返回数据封装类
 * 
 * @author heizq
 * @date 2017-04-11 20:01:42
 * @since v1.0.0
 */
@SuppressWarnings("serial")
@XStreamAlias("FM")
public class QueryOrderByFuiouOrderNumContent extends Content {

	/**
	 * 响应代码 5185表示“订单已支付” 5077表示“无此订单” 11V3表示“订单失效” 11E3表示“订单支付失败”
	 */
	@XStreamAlias("Rcd")
	private String responseCode;

	/**
	 * 中文描述
	 */
	@XStreamAlias("RDesc")
	private String responseMsg;

	/**
	 * MD5摘要数据 Rcd+"|"+ mchnt_key 做md5摘要其中mchnt_key 为32位的商户密钥，系统分配
	 */
	@XStreamAlias("Sign")
	private String sign;

	public String getResponseCode() {
		return responseCode;
	}

	public void setResponseCode(String responseCode) {
		this.responseCode = responseCode;
	}

	public String getResponseMsg() {
		return responseMsg;
	}

	public void setResponseMsg(String responseMsg) {
		this.responseMsg = responseMsg;
	}

	public String getSign() {
		return sign;
	}

	public void setSign(String sign) {
		this.sign = sign;
	}

	/**
	 * 该实体转换成XML字符串
	 * 
	 * @author heizq
	 * @date 2017-4-12 10:52:52
	 * @since v1.0.0
	 * @return 返回XML字符串
	 */
	public String toXml() {
		QNameMap qmap = new QNameMap();
		qmap.setDefaultNamespace("http://www.99bill.com/mas_cnp_merchant_interface");
		qmap.setDefaultPrefix("");
		StaxDriver staxDriver = new StaxDriver(qmap);
		XStream xstream = new XStream(staxDriver);
		xstream.autodetectAnnotations(true);
		xstream.ignoreUnknownElements();
		xstream.alias("FM", QueryOrderByFuiouOrderNumContent.class);
		return xstream.toXML(this);
	}

	/**
	 * XML字符串转换成实体{@link QueryOrderByFuiouOrderNumContent}
	 * 
	 * @author heizq
	 * @date 2017-4-12 10:53:28
	 * @since v1.0.0
	 * @param xml
	 * @return 返回{@link QueryOrderByFuiouOrderNumContent}
	 */
	public static QueryOrderByFuiouOrderNumContent fromXml(String xml) {
		QNameMap qmap = new QNameMap();
		qmap.setDefaultNamespace("http://www.99bill.com/mas_cnp_merchant_interface");
		qmap.setDefaultPrefix("");
		StaxDriver staxDriver = new StaxDriver(qmap);
		XStream xstream = new XStream(staxDriver);
		xstream.autodetectAnnotations(true);
		xstream.ignoreUnknownElements();
		xstream.alias("FM", QueryOrderByFuiouOrderNumContent.class);
		return (QueryOrderByFuiouOrderNumContent) xstream.fromXML(xml);
	}
}
